package com.digital.herbarium.Util;

import cn.hutool.core.util.StrUtil;
import com.digital.herbarium.Entity.Specimen;
import com.digital.herbarium.Exception.CustomException;

public class SpecimenUtil {


    public  static void checkInfo(Specimen specimen){
        if(StrUtil.hasEmpty(specimen.getLibraryCode()) || StrUtil.hasBlank(specimen.getLibraryCode())){
            throw new CustomException(400,"馆代码不能为空");
        }
//        if(StrUtil.hasEmpty(specimen.getSerialNumber()) || StrUtil.hasBlank(specimen.getSerialNumber())){
//            throw new CustomException(400,"流水号不能为空");
//        }
        if(StrUtil.hasEmpty(specimen.getBarCode()) || StrUtil.hasBlank(specimen.getBarCode())){
            throw new CustomException(400,"条形码不能为空");
        }
        if(StrUtil.hasEmpty(specimen.getSpecimenName()) || StrUtil.hasBlank(specimen.getSpecimenName())){
            throw new CustomException(400,"中文名不能为空");
        }
        if(StrUtil.hasEmpty(specimen.getProvince()) || StrUtil.hasBlank(specimen.getProvince())){
            throw new CustomException(400,"省市不能为空");
        }
        if(StrUtil.hasEmpty(specimen.getDistrict()) || StrUtil.hasBlank(specimen.getDistrict())){
            throw new CustomException(400,"区县不能为空");
        }
        if(StrUtil.hasEmpty(specimen.getAuthenticateEr()) || StrUtil.hasBlank(specimen.getAuthenticateEr())){
            throw new CustomException(400,"鉴定人不能为空");
        }
        if(StrUtil.hasEmpty(specimen.getGatherer()) || StrUtil.hasBlank(specimen.getGatherer())){
            throw new CustomException(400,"采集人不能为空");
        }
    }
}
